﻿using System.Collections.Generic;
using System.Linq;
using JStore.Core.Entities;
using SpeadFrm.ORM;

namespace JStore.Data.Daos
{
    /// <summary>
    ///
    /// </summary>
    public class UserTypeDao : BaseDao<UserType>
    {
        public List<UserType> GetAll()
        {
            var sql = Sql.Builder.Where("1=1");
            return Query(sql).ToList();
        }

        public UserType GetById(int id)
        {
            var sql = Sql.Builder.Where("Id = @0", id);
            return FirstOrDefault(sql);
        }

        public void DeleteById(int id)
        {
            var sql = Sql.Builder.Where("Id = @0", id);
            Delete(sql);
        }


        public List<UserType> GetByIds(List<int> ids)
        {
            var sql = Sql.Builder.Where("Id IN (@0)", ids);
            return Query(sql).ToList();
        }
    }
}

